Skip to content

[CP] Guard certificate completion after crypto cleanup (#6445) - #6485

Merged
Guillaume Hetier (guhetier) merged 1 commit into
release/2.5from
guhetier/cp_guard_cert_completion_2_5_copilot
Nov 11, 2026
Merged

Guillaume Hetier (guhetier) merged 1 commit into
release/2.5from
guhetier/cp_guard_cert_completion_2_5_copilot

Conversation

@guhetier

Copy link
Copy Markdown
Collaborator

Description

While application certificate validation is pending, MsQuic pauses TLS processing and may buffer additional CRYPTO data.

When the application completes validation, QuicCryptoCustomCertValidationComplete synchronously resumes TLS processing. That nested processing can complete the handshake and uninitialize the crypto receive state before returning to the completion function.

The certificate path now guards that QuicRecvBufferHasUnreadData query with Crypto->Initialized .

Ticket-validation assertion

A similar code is present here too, but ticket validation occurs earlier in handshake processing, before handshake completion is expected to discard crypto state. Therefore, crypto state should always remain initialized when QuicCryptoCustomTicketValidationComplete reaches its unread-data query. The debug assertion is added for this invariant.

ICM 31000000772553

Testing

BVT and CI

Documentation

N/A

## Description
While application certificate validation is pending, MsQuic pauses TLS
processing and may buffer additional CRYPTO data.

When the application completes validation,
`QuicCryptoCustomCertValidationComplete` synchronously resumes TLS
processing. That nested processing can complete the handshake and
uninitialize the crypto receive state before returning to the completion
function.

The certificate path now guards that `QuicRecvBufferHasUnreadData` query
with Crypto->Initialized .

Ticket-validation assertion

A similar code is present here too, but ticket validation occurs earlier
in handshake processing, before handshake completion is expected to
discard crypto state. Therefore, crypto state should always remain
initialized when QuicCryptoCustomTicketValidationComplete reaches its
unread-data query. The debug assertion is added for this invariant.

ICM 31000000772553

## Testing
BVT and CI

## Documentation
N/A

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: bd06d130-070d-44d0-a470-092953f341f3
@guhetier
Guillaume Hetier (guhetier) marked this pull request as ready for review November 11, 2026 19:20
@guhetier
Guillaume Hetier (guhetier) requested a review from a team as a code owner November 11, 2026 19:20
@guhetier
Guillaume Hetier (guhetier) merged commit def143d into release/2.5 Nov 11, 2026
279 of 283 checks passed
@guhetier
Guillaume Hetier (guhetier) deleted the guhetier/cp_guard_cert_completion_2_5_copilot branch November 11, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backport request: #6445 ("Guard certificate completion after crypto cleanup") is missing from release/2.5 and release/2.6

2 participants